package com.iweb.controller;

import com.iweb.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * 南京艾瑞
 * 作者: jack
 * 时间: 2020-06-28 19:15
 * 描述: UserController
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping(value = "/formData", method = RequestMethod.POST)
    public ModelAndView formData(@RequestBody String body) {
        System.out.println(body);
        return new ModelAndView("success");
    }

    @RequestMapping(value = "/json", method = RequestMethod.POST)
    @ResponseBody
    public User json(@RequestBody User user) {
        System.out.println(user);
        return user;
    }
}
